package day4;

import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Test3_Date {
    public static void main(String[] args) throws Exception{
        // JDK 自带的日期时间转换函数
        SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
        Date d1 = sdf.parse("2022-02-12 16:40:40");
        System.out.println(d1.getTime()); // 转成时间戳

        String s = sdf.format(1644655240000L);
        System.out.println(s);

        Date date = DateUtils.parseDate("22-02-12 16:40:40", Constants.D1);
        System.out.println(date.getTime());

        /*String date2 = DateFormatUtils.format("1644655240000L", "yy-MM-dd HH:mm:ss");
        System.out.println(date2);*/

    }
}
